package MyRemoteSorter;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
import java.util.Random;

public class SortFactory extends UnicastRemoteObject implements ISortFactory{
	public static final int QUICKSORT = 0;
	public static final int INSERTSORT = 1;
	public static final int BUBBLESORT = 2;
	
	public SortFactory()throws RemoteException 
	{
		super();
	}
	
	public ISorter createSorter()throws RemoteException 
	{
		return createSorter(2);
	}
	
	public ISorter createSorter(int type)throws RemoteException
	{
		switch(type)
		{
		default:
			return new QuickSort();
		case QUICKSORT:
			return new QuickSort();
		case INSERTSORT:
			return new InsertionSort();
		case BUBBLESORT:
			return new BubbleSort();
		}
	}
}
